package com.wanxi.test;
//计算器
import java.util.Scanner;

public class Calculator {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入操作（+-*/）： ");
        String operate = scanner.next();
        System.out.print("请输入第一个数字： ");
        int num1 = scanner.nextInt();
        System.out.print("请输入第二个数字： ");
        int num2 = scanner.nextInt();

        switch (operate){
            case "+":
                System.out.println("num1 + num2 = " + (num1 + num2));
                break;
            case "-":
                System.out.println("num1 - num2 = " + (num1 - num2));
                break;

            case "*":
                System.out.println("num1 * num2 = " + (num1 * num2));
                break;
            case "/":
                System.out.println("num1 / num2 = " + (num1 / num2));
                break;
            default:
                System.out.println("输入有误");



        }


        scanner.close();
    }
}
